package com.dongnaoedu.rpc.redis.server;

import com.dongnaoedu.rpc.redis.Channel;
import com.dongnaoedu.rpc.redis.client.ClientMessage;

public class ServerAccept {
	public final String className;
	public final String methodName;
	public final Object[] args;
	public final String replyChannel;
	public final String messageId;
	public final String serverChannel;

	public ServerAccept(String serverChannel, ClientMessage message) {
		//TODO validation rule
		String[] types = serverChannel.split(Channel.SPLIT);
		this.serverChannel = serverChannel;
		this.className = types[1];
		this.methodName = types[2];
		this.replyChannel = message.getConsumerChannel();
		this.messageId = message.getMsgId();
		this.args = message.getArgs();
	}
}
